﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Algobox.JuicyLib.MarketData;

namespace Algobox.JuicyLib.Apps.Stoxx
{
    public static class StoxxAdaptor
    {

        const string WBAH = "XETRA (AT)";
        const string XBRU = "EURONEXT (BE)";
        const string XLON = "LSE";
        const string XOSL = "Oslo";
        const string XSWX = "SIX Swiss Excha";
        const string XETR = "XETRA (DE)";
        const string XCSE = "OMX (DK)";
        const string XMCE = "SIBE";
        const string XLIS = "EURONEXT (PT)";
        const string XHEL = "OMX (FI)";
        const string XPAR = "EURONEXT (FR)";
        const string XAMS = "EURONEXT (NL)";
        const string XATH = "Athens";
        const string XDUB = "XETRA (IE)";
        const string XMIL = "Milan";
        const string XSTO = "OMX (SE)";



        public static bool TryGetMarketMIC(string exchange, out MarketDataConstants.MarketMICS marketMIC)
        {
            exchange = exchange.Trim();

            switch (exchange)
            {
                case XLON:
                    marketMIC = MarketDataConstants.MarketMICS.XLON;
                    return true;
                case XAMS:
                    marketMIC = MarketDataConstants.MarketMICS.XAMS;
                    return true;
                case XPAR:
                    marketMIC = MarketDataConstants.MarketMICS.XPAR;
                    return true;
                case XMIL:
                    marketMIC = MarketDataConstants.MarketMICS.XMIL;
                    return true;
                case XSWX:
                    marketMIC = MarketDataConstants.MarketMICS.XSWX;
                    return true;
                case XBRU:
                    marketMIC = MarketDataConstants.MarketMICS.XBRU;
                    return true;
                case XLIS:
                    marketMIC = MarketDataConstants.MarketMICS.XLIS;
                    return true;
                case XSTO:
                    marketMIC = MarketDataConstants.MarketMICS.XSTO;
                    return true;
                case XOSL:
                    marketMIC = MarketDataConstants.MarketMICS.XOSL;
                    return true;
                case XCSE:
                    marketMIC = MarketDataConstants.MarketMICS.XCSE;
                    return true;
                case XMCE:
                    marketMIC = MarketDataConstants.MarketMICS.XMCE;
                    return true;
                case XHEL:
                    marketMIC = MarketDataConstants.MarketMICS.XHEL;
                    return true;
                case XETR:
                    marketMIC = MarketDataConstants.MarketMICS.XETR;
                    return true;
                case WBAH:
                    marketMIC = MarketDataConstants.MarketMICS.WBAH;
                    return true;
                case XDUB:
                    marketMIC = MarketDataConstants.MarketMICS.XDUB;
                    return true;
                case XATH:
                    marketMIC = MarketDataConstants.MarketMICS.XATH;
                    return true;
                default:
                    marketMIC = MarketDataConstants.MarketMICS.XXXX;
                    return false;
            }
        }
    }
}
